package com.airsystem.pos.bengkel.model.dialog;

import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

import com.airsystem.pos.bengkel.component.DialogFrame;
import com.airsystem.pos.bengkel.entity.PesanSparepart;
import com.airsystem.pos.bengkel.entity.wrapper.PesanSparepartWrapper;
import com.toedter.calendar.JDateChooser;

/**
 * @author Fanny Irawan Sutawanir (fannyirawans@gmail.com)
 */
public class SparepartOrderDialogModel extends DialogFrame {
	protected final GridBagLayout baseLayout = new GridBagLayout();
	protected final GridBagLayout tableLayout = new GridBagLayout();

	protected final JPanel basePanel = new JPanel();
	protected final JPanel tablePanel = new JPanel();

	protected final JScrollPane tableScroll = new JScrollPane();

	protected final JTable tableData = new JTable();

	protected final JLabel searchLabel = new JLabel();

	protected final JComboBox searchCombo = new JComboBox();

	protected final JDateChooser searchField = new JDateChooser();

	protected final JButton searchButton = new JButton();

	protected static final String[] COMBOS = { "Tanggal Pesan" };

	protected static final String[] COLUMNS = { "Tanggal Pesan", "Total Produk", "Total Harga", "Pembayaran" };

	protected final DefaultTableModel tableModel = new DefaultTableModel(new Object[][] {}, COLUMNS) {
		final boolean[] canEdit = new boolean[] { false, false, false, false };

		public boolean isCellEditable(int rowIndex, int columnIndex) {
			return canEdit[columnIndex];
		}
	};

	protected PesanSparepartWrapper pesanSparepartWrapper;

	protected PesanSparepart getSearchData() {
		PesanSparepart searchPesanSparepart = new PesanSparepart();
		searchPesanSparepart.setTanggal(searchField.getDate());

		return searchPesanSparepart;
	}

	public PesanSparepartWrapper getDataPesanSparepart() {
		return pesanSparepartWrapper;
	}
}